"""
tcp 客户端
"""
from socket import *
ADDR = ("127.0.0.1",8888)
# 创建tcp对象，不写参数默认就是tcp对象
tcp_socket = socket()

# 连接服务端
tcp_socket.connect(ADDR)

# 循环发送信息
while True:
    msg = input(">>")
    tcp_socket.send(msg.encode())
    if msg == '##':
        break
    data = tcp_socket.recv(1024)
    print("From server:",data.decode())

tcp_socket.close()

